-- enter_instance
-- create by dengc
-- 道具：进入副本

return {
    apply = function(source, target, classId, value)
        local args = value;
        if type(args) ~= "table" then
            return;
        end

        local instanceId = args["instance_id"];
        if type(instanceId) ~= "number" then
            return;
        end

        if source.type ~= OBJECT_TYPE_USER then
            return;
        end

        -- 抛出使用道具进入迷宫事件
        EventMgr.fire(event.USE_PROP_ENTER_INSTANCE, {["instance_id"] = instanceId, });

        -- 开始副本
        return DungeonInstanceM.startInstance(0, instanceId);
    end,
};
